<?php
require 'Adapter.php';
class Db_Adapter_sqlLite implements Db_Adapter{
    private $_dbLink;//数据库连接字符串标示

    /**
     * 数据库连接函数
     * @param $config 数据库配置
     * @throws Db_Exception
     * @return resource
     * 
    */
    public function connect($config)
    {
        if($this->_dbLink = sqlite_open($config['file'],0666,$error)){
            return $this->_dbLink;
        }
        /*数据库异常*/
        throw new Db_Exception($error);
    }


    /**
     * @param string $query数据库查询字符串
     * @param mixed $handle 连接对象
     * @return resource
     * 
    */
    public function query($query, $handle)
    {
        if($resource = @sqlite_query($query,$handle)){
            return $resource;
        }
    }
}